package com.fsc.eureka;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import com.alibaba.fastjson.JSON;

/**
* @Comments Run Configurations -> MicroSrvEruekaApplication -> Program arguments:--spring.profiles.active=slave1
* @Author  zg
* @Date 2018年8月22日
*/
@EnableEurekaServer
@SpringBootApplication
public class MicroSrvEruekaApplication {
	private static Class<?> cla = MicroSrvEruekaApplication.class;
	private static final Logger logger = LoggerFactory.getLogger(cla);
	
	public static void main(String[] args) {
		logger.info("args:{}", JSON.toJSONString(args));
		ConfigurableApplicationContext cofigAppCont = SpringApplication.run(cla, args);
		ConfigurableEnvironment confEnv = cofigAppCont.getEnvironment();
		String host = confEnv.getProperty("eureka.instance.hostname");
		String port = confEnv.getProperty("server.port");
		
		logger.info("MicroSrvEruekaApplication started on {}:{} >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", host, port);
	}
}
